package com.ruoyi.wechat.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wechat.domain.CommunicationVo;
import com.ruoyi.wechat.service.ICommunicationidService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wechat/communication")
@Slf4j
public class WxCommunication extends BaseController {

    @Autowired
    private ICommunicationidService communicationidService;

    @GetMapping("/list")
    public AjaxResult list() {
        List<CommunicationVo> communicationVoList = communicationidService.select();
        return success(communicationVoList);
    }

    @PostMapping("/save")
    public AjaxResult save(@RequestBody CommunicationVo communicationVo) {
        log.info("save:{}", communicationVo);
        return toAjax(communicationidService.insertCommunicationVo(communicationVo));
    }

}
